<?php
/**
 * Created by IntelliJ IDEA.
 * User: TinND
 * Date: 4/3/14
 * Time: 1:57 PM
 */
include '../connection.php';
include 'core.php';
$data = json_decode(file_get_contents("php://input"));
if (isset($data->api)) {
    mysql_query("SET NAMES 'utf8'");

    switch ($data->api) {
        case 2222:
            $query = "
            DELETE FROM `u887941657_nitin`.`Product` WHERE `Product`.`id` = $data->id ;" . "";
            $result = mysql_query($query, $link) or die('Errant query:  ' . $query);
            if ($result && mysql_affected_rows() > 0) {
                deleteImage($data->id, null);
            }
            header('Content-type: application/json');
            $answer = array('success' => true, 'data' => $result);
            echo json_encode($answer);
            break;
        case 2223:
            break;
        case 2224:
            break;
    }
} else {
    echo json_encode(array('success' => false, 'data' => $data->api));
}
@mysql_close($link);